package zuoye4;

import java.util.HashMap;
import java.util.Map;

public class JiangHu {
    public static void main(String[] args) {
        Map<Integer,String> JiangMap=new HashMap<>();
        JiangMap.put(1,"张三丰");
        JiangMap.put(2,"周芷若");
        JiangMap.put(3,"白眉鹰王");
        JiangMap.put(4,"灭绝师太");

        //遍历输出，打印序号和对应人名
        for (Integer key:JiangMap.keySet()) {
            String str=JiangMap.get(key);
            System.out.println("keys="+key);
            System.out.println("values="+str);

        }


        //插入编号为5，名为李晓红的信息
        JiangMap.put(5,"李晓红");

       //移除编号为1的信息
        JiangMap.remove(1);

        //将编号为2 的名字信息修改为 周林
        JiangMap.replace(2,"周林");

        System.out.println("*******************************");

        for (Integer key:JiangMap.keySet()) {
            String str=JiangMap.get(key);
            System.out.println("keys="+key);
            System.out.println("values="+str);

        }
    }

}
